home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / util / rexx / rxcmanager.lha / rxcmanager / examples / CManager_UserAddress.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1998-10-15  |  2.4 KB  |  120 lines

  1. /*
  2.     $VER: CManager_UserAddress.rexx 1.0 (16.10.98) by Simone Tellini
  3. */
  4.  
  5. options results                             /* enable return codes     */
  6.  
  7. if (left(address(), 6) ~= "GOLDED") then    /* not started by GoldEd ? */
  8.  
  9.     address 'GOLDED.1'
  10.  
  11. 'LOCK CURRENT RELEASE=4'                    /* lock GUI, gain access   */
  12.  
  13. if (RC ~= 0) then
  14.  
  15.     exit
  16.  
  17. options failat 6                            /* ignore warnings         */
  18.  
  19. signal on syntax                            /* ensure clean exit       */
  20.  
  21. /* ---------------------- INSERT YOUR CODE HERE ---------------------- */
  22.  
  23. if ~show("L","rxcmanager.library") then
  24.     if ~addlib("rxcmanager.library",0,-30) then do
  25.         say "no rxcmanager.library"
  26.         exit
  27.     end
  28.  
  29. parse arg Search
  30.  
  31. if Search = 'search' then do
  32.  
  33.     'REQUEST STRING TITLE="Enter the name of the user to search for:" VAR=K'
  34.  
  35.     patt.Name     = '#?'k'#?'
  36.     patt.LastName = '#?'k'#?'
  37.  
  38.     num = CMFind("USER","REC","PATT",1)
  39.  
  40. end
  41. else do
  42.  
  43.     call CMStart()
  44.     num = CMGetEntry("USER MULTISELECT","REC")
  45.     call CMClose()
  46. end
  47.  
  48. if num > 0 then do
  49.  
  50.     do i=0 to num-1
  51.  
  52.         'CR'
  53.         'FIRST'
  54.  
  55.         'TEXT T="'rec.i.Name' 'rec.i.LastName'"'
  56.         'CR'
  57.         'FIRST'
  58.  
  59.         if rec.i.Address ~= '' then do
  60.  
  61.             addr = rec.i.Address
  62.  
  63.             newline = index( addr, '0a'x )
  64.  
  65.             do while newline ~= 0
  66.  
  67.                 'TEXT T="'left( addr, newline - 1 )'"'
  68.                 'CR'
  69.                 'FIRST'
  70.  
  71.                 addr = right( addr, length( addr ) - newline )
  72.  
  73.                 newline = index( addr, '0a'x )
  74.             end
  75.  
  76.             'TEXT T="'addr'"'
  77.             'CR'
  78.             'FIRST'
  79.         end
  80.  
  81.         if rec.i.ZIP ~= '' || rec.i.City ~= '' then do
  82.  
  83.             space = 0
  84.  
  85.             if rec.i.ZIP ~= '' then do
  86.                 'TEXT T="'rec.i.ZIP'"'
  87.                 space = 1
  88.             end
  89.  
  90.             if rec.i.City ~= '' then do
  91.  
  92.                 if space then 'TEXT T=" "'
  93.  
  94.                 'TEXT T="'rec.i.City'"'
  95.             end
  96.  
  97.             'CR'
  98.             'FIRST'
  99.         end
  100.  
  101.         if rec.i.Country ~= '' then do
  102.             'TEXT T="'rec.i.Country'"'
  103.             'CR'
  104.             'FIRST'
  105.         end
  106.     end
  107. end
  108.  
  109. /* ------------------------- END OF YOUR CODE ------------------------ */
  110.  
  111. 'UNLOCK'                                    /* unlock GUI              */
  112.  
  113. exit
  114.  
  115. SYNTAX:
  116.  
  117. SAY "Error in line" SIGL ":" ERRORTEXT(RC)
  118.  
  119. 'UNLOCK'
  120.